/**
 * 
 */
package com.feonix.designPattern.singleton.sample5;

/**
 * @CopyRight (c)1993-2017
 * @Project common_practice
 * @Comments 请输入该类的描述
 * @NameSpace com.feonix.designPattern.singleton.sample5
 * @Author Feonixzw
 * @CreateDate 2018年1月31日
 */
public class Singleton {
	private static Singleton singleton = null;

	private Singleton() {
		System.out.println("生成了一个实例。");
		sleep();
	}

	public static Singleton getInstance() {
		if (singleton == null) {
			singleton = new Singleton();
		}
		return singleton;
	}

	private void sleep() {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
